<?php

/**
 * Yii MyMenu Widget 
 *
 * @author luunguyen
 * @since Sep 24, 2012 - 1:58:44 PM
 */
class SidebarMenu extends OpendevMenu
{

    public $linkLabelWrapper = 'span';

    /**
     * Renders the content of a menu item.
     * Note that the container and the sub-menus are not rendered here.
     * @param array $item the menu item to be rendered. Please see {@link items} on what data might be in the item.
     * @return string
     * @since 1.1.6
     */
    protected function renderMenuItem($item)
    {
        // Thêm biểu tượng vào Menu
        $icon = isset($item['icon']) ? $item['icon'] : '';
        $i    = ($icon != '') ? "<i class='icon-$icon'></i> " : "";

        if (isset($item['url']))
        {
            $label = $this->linkLabelWrapper === null ? $item['label'] : '<' . $this->linkLabelWrapper . '>' . $item['label'] . '</' . $this->linkLabelWrapper . '>';
            return CHtml::link($i . $label, $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
        }
        else
            return CHtml::tag('span', isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']);
    }

}

/** 
 * End file MyMenu
 */
